package com.banana.springcloud.service;

import com.banana.springcloud.entity.CommonResult;
import com.banana.springcloud.entity.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * FeignClient注解中的value属性指定了要调用的{服务}名
 * @author layman
 * @date 2021/1/17
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface OpenFeignOrderService {

    /**
    * 查询payment
    * @param id：主键
    * @return CommonResult<Payment>
    */
    @GetMapping(value = "/payment/get/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    /**
    * 模拟openFeign访问超时
    * @return String
    */
    @GetMapping("/payment/openfeign/timeout")
    String openFeignTimeOut();
}
